package com.qingcloud.api.dcengine.model.sdata;

import com.qingcloud.api.dcengine.enums.DataExceptionTypeEnum;
import com.qingcloud.api.dcengine.enums.PollutionValidField;
import com.qingcloud.api.dcengine.model.BasePageParam;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;

/**
 * 监测点数据通用分页参数对象
 */
@Getter
public class StationValidPageParam extends BasePageParam {

    @ApiModelProperty(value = "监测点编号列表", required = true)
    @Setter
    private Collection<String> stationIdList;

    @ApiModelProperty(value = "污染物数据有效性 1有效 2待审核 3无效")
    @Setter
    private Integer valid;

    @ApiModelProperty(value = "筛选的污染物 pm25 pm10等")
    @Setter
    private List<String> pollutionList;

    private List<String> pollutionValidList;

    public List<String> getPollutionValidList() {
        if (this.pollutionList != null && !this.pollutionList.isEmpty()) {
            List<String> validList = new ArrayList<>(pollutionList.size());
            for (String data : this.pollutionList) {
                validList.add(PollutionValidField.getFieldByTitle(data));
            }
            return validList;
        }
        return Collections.emptyList();
    }

    /**
     * 参考枚举
     *
     * @see DataExceptionTypeEnum
     */
    @ApiModelProperty(value = "数据异常类型")
    @Setter
    private List<Integer> dataExceptionTypeList;

    @ApiModelProperty(value = "数据异常类型")
    @Setter
    private List<String> exceptionTypeStrList;

//    public void setDataExceptionTypeList(List<Integer> dataExceptionTypeList) {
//        this.dataExceptionTypeList = dataExceptionTypeList;
//        if(this.dataExceptionTypeList!=null){
//            exceptionTypeStrList =  new ArrayList<String>();
//            for(Integer data : this.getDataExceptionTypeList()){
//                exceptionTypeStrList.add(DataExceptionTypeEnum.getNameByCode(data));
//            }
//        }
//    }

}
